<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<html>
<head>
    <title>修改用户信息</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui-v2.9.10/layui/css/layui.css"/>
    <style>
        .margin-top {
            margin-top: 20px; /* 你可以根据需要调整这个值 */
        }

        body {
            background-color: #f5f5f5;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
        }
        .layui-nav-child{
            color: #0C0C0C;
        }
        .layui-header {
            background-color: #303030;
            color: #fff;
            padding: 0 15px;
        }
        .layui-header .layui-logo {
            font-size: 24px;
            line-height: 60px;
            margin-right: 30px;
        }

        .layui-side, .layui-layout-admin .layui-body, .layui-footer {
            background-color: #f5f5f5;
            color: #333;
        }
        .layui-card-header {
            background-color: #303030;
            color: #fff;
        }
        .layui-card-body {
            background-color: #fff;
            color: #333;
        }
        .layui-layout-admin .layui-body {
            padding: 15px;
        }
        .layui-side {
            background-color: #333; /* 背景颜色 */
            flex-shrink: 0;
        }
        .layui-side-scroll {
            height: 100%; /* 高度设为100% */
            overflow: auto;
        }
    </style>


</head>
<body>
<div class="layui-layout layui-layout-admin">
    <!-- 头部导航 -->
    <%--头部导航--%>
    <div class="layui-header">
        <jsp:include page="header.jsp" />
    </div>


    <div class="layui-side">
        <jsp:include page="side.jsp" />
    </div>
    <!-- 内容区域 -->
    <div class="layui-body">
        <div class="layui-container">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <form class="layui-form" action="${pageContext.request.contextPath}/ModifyUser.do" method="post">
                        <input type="hidden" name="id" value="${user.id}"/>
                        <div class="margin-top"></div> <!-- 这个div上方将会有一定数量的空白 -->
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-block">
                                <input type="text" name="username" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input" value="${user.username}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">email</label>
                            <div class="layui-input-block">
                                <input type="text" name="email" required lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="${user.email}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">电话</label>
                            <div class="layui-input-block">
                                <input type="text" name="phone" required lay-verify="required" placeholder="请输入电话" autocomplete="off" class="layui-input" value="${user.phone}">
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">用户类型</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="user_type" value="0" title="买家" ${user.user_type == 0? 'checked' : ''}>
                            </div>
                            <div class="layui-input-inline">
                                <input type="radio" name="user_type" value="1" title="卖家" ${user.user_type == 1 ? 'checked' : ''}>
                            </div>
                            <div class="layui-input-inline">
                                <input type="radio" name="user_type" value="2" title="管理员" ${user.user_type == 2 ? 'checked' : ''}>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                                <a href="usermanager.jsp" class="layui-btn layui-btn-primary">取消</a>
                            </div>
                        </div>
                    </form>
                    <c:if test="${not empty error}">
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <p style="color: red;">${error}</p>
                            </div>
                        </div>
                    </c:if>
                </div>
            </div>
        </div>
    </div>
    <!-- 底部区域 -->
    <div class="layui-footer">
        © 新闻发布系统 - 版权所有
    </div>
</div>
<script src="${pageContext.request.contextPath}/layui-v2.9.10/layui/layui.js"></script>
<script>
    layui.use(['form'], function(){
        var form = layui.form;
        // 表单验证和提交可以在这里处理
        form.on('submit(formDemo)', function(data){
            // 可以进行表单验证和数据处理
            return true; // 阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>
</body>
</html>
